/*
 * @Description: 页面描述：组织架构接口
 * @Author: Yong
 * @Date: 2021-05-12 17:59:12
 */
import request from '@/utils/request';

/**
 * @description: 获取组织架构
 * @author: Yong
 * @function   getDepartments
 * @return {*}
 * @date: 2021-05-12 17:59:37
 */

export function getDepartments () {
    return request({
        url: '/company/department'
    })
}

/**
 * @description: 根据id删除部门
 * @author: Yong
 * @function   delDepartments
 * @param {*}  参数
 * @param {*}  参数
 * @return {*} 
 * @date: 2021-05-12 21:11:21
 */

export function delDepartments (id) {
    return request({
        url: `/company/department/${id}`,
        method: 'delete'
    })
}

/**
 * @description:新增部门接口
 * @author: Yong
 * @function   addDepartments
 * @param {*}  data
 * @return {*} 
 * @date: 2021-05-12 21:28:52
 */

export function addDepartments (data) {
    return request({
        url: '/company/department',
        method: 'post',
        data
    })
}

/**
 * @description:新增部门接口
 * @author: Yong
 * @function   getDepartDetail
 * @param {*}  id
 * @return {*} 
 * @date: 2021-05-12 21:28:52
 */

export function getDepartDetail (id) {
    return request({
        url: `/company/department/${id}`
    })
}

/**
 * @description:更新部门详情接口
 * @author: Yong
 * @function   updateDepartments
 * @param {*}  data
 * @return {*} 
 * @date: 2021-05-12 21:28:52
 */

export function updateDepartments (data) {
    return request({
        url: `/company/department/${data.id}`,
        method: 'put',
        data
    })
}

